/*
 * @lc app=leetcode.cn id=1207 lang=typescript
 *
 * [1207] 独一无二的出现次数
 */

// @lc code=start
function uniqueOccurrences(arr: number[]): boolean {
    const cache = new Map<number, number>();
    arr.forEach((i) => {
        cache.set(i, (cache.get(i) || 0) + 1);
    });
    let set = new Set<number>();
    for (const iterator of cache.values()) {
        if (set.has(iterator)) {
            return false;
        } else {
            set.add(iterator);
        }
    }
    return true;
}
// @lc code=end
